package com.angel.email.configuration.builders;

import javax.mail.Authenticator;

import com.angel.email.account.AccountInformation;
import com.angel.email.authenticator.EmailAuthenticator;

/**
 *
 * @author William
 *
 */
public abstract class ServiceEmailConfigurationBuilder {

	private AccountInformation accountInformation;
	
	public ServiceEmailConfigurationBuilder(AccountInformation accountInformation){
		super();
		this.setAccountInformation(accountInformation);
	}

	/**
	 * @return the accountInformation
	 */
	public AccountInformation getAccountInformation() {
		return accountInformation;
	}

	/**
	 * @param accountInformation the accountInformation to set
	 */
	public void setAccountInformation(AccountInformation accountInformation) {
		this.accountInformation = accountInformation;
	}

	public boolean hasAccountInformation() {
		return this.getAccountInformation() != null;
	}
	
	public Authenticator buildAuthenticator(){
		return new EmailAuthenticator(this.getAccountInformation());
	}

}
